﻿namespace NMA.Infrastructure.NHibernate.CriteriaExpression.Category.SearchCategory.Responsibility
{
    using NMA.Domain.Model.Contract;

    public class AllSearch : SearchCategoryTypeFinder
    {
        public override SearchCategoryCriteriaType GetSearchCategoryType(CategorySearchCriteria model)
        {
            if (model.Id.CompareTo(null) == 0 && string.IsNullOrEmpty(model.Name)
                && string.IsNullOrEmpty(model.CreatedUser) && model.CreatedDate == null)
            {
                return SearchCategoryCriteriaType.All;
            }
            else
                if (Finder != null)
                    return Finder.GetSearchCategoryType(model);

            return SearchCategoryCriteriaType.All;
        }
    }
}